ulsufandomcom-20200215-history
Emerald AI
'Emerald AI 1.3.5 and Ultimate Survival 0.13' Making the Ultimate Survival player damage Emerald AI Step 1 • Option A: Make your AI's rig a humanoid. Select your AI in the scene and run it through the Ultimate Survival ragdoll in the Ultimate Survival menu. Once ragdoll is created set your AI's rig back to what ever you need it to be (if you don't want it to be a humanoid.) • Option B: Set up your ragdoll manually without changing it to a humanoid, or use what ever auto ragdoll assets you might have. Overall, you want to create a ragdoll for your AI. How you do it is up to you. Step 2 Set your Emerald AI onto the "Entity" Layer Step 3 Change your Emerald AI's layer to "Entity" in the AI Config Step 4 Add the Ultimate Survival "Ragdoll" Script to the game object on your AI that's holding the rig, not the first bone like the hip but the one that's usually the parent of first bone. (Where you put this might not really matter too much though.) Step 5 Setup the Ragdoll script as follows: • Pelvis = AI's pelvis bone • Normal Layer = HitBox • Ragdoll Layer = Default • Surface = Assign one. (You can select the Ultimate Survival "boar" texture if you're too lazy to set your AI's texture up in US.) • Auto Assign HitBoxes = Yes (ticked) Step 6 Add the HitBox script to all the bones in your AI that have a collider on them. Step 7 Set your Emerald AI's tag to "Respawn" or what ever you need your AI to be on (make sure to adjust the code if you make it different though.) You could also make this a public option that can be set in the script through your editor if you have AI with different unity tags. THEN Add this script to line 33 of your Ultimate Survival HitBox script: if (m_ParentEntity.tag "Respawn") { m_Collider.GetComponentInParent().SendMessage ("Damage", -damageData.Delta); } Step 8 Add Ultimate Survival's AI Event Handler script to your AI (important.) Making Emerald AI damage the Ultimate Survival player Step 9 Add the following to the top of your Emerald Animal AI script (some might not be needed but I was too lazy to figure out which so you can remove them one by one and see which ones affect the code in step 10.) using UltimateSurvival; using UltimateSurvival.AI; using UltimateSurvival.Building; using UltimateSurvival.Debugging; using UltimateSurvival.GUISystem; using UltimateSurvival.InputSystem; using UltimateSurvival.StandardAssets; Step 10 Add this to line 3301 in the Emerald Animal AI code currentAnimal.GetComponent ().Entity.ChangeHealth.Try (new HealthEventData (-attackDamage)); var col = currentAnimal.GetComponent(); if(col != null) { var data = SurfaceDatabase.Instance.GetSurfaceData(col, currentAnimal.transform.position + Vector3.up, 0); if(data != null) data.PlaySound(ItemSelectionMethod.RandomlyButExcludeLast, SoundType.Hit, 1f, currentAnimal.transform.position + Vector3.up * 1.5f); } This should integrate Emerald and US just fine. If there's any minor bugs they should be easy to fix and would just be from my lack of coding knowledge. I have run into some bugs and the above instructions have fixed them. Tutorial from Zelre / Gegebel Category:Integrations